<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>


<html>
	<head>

		<title>Monitor System Demo</title>
		<script type="text/javascript">
	var timer;
	flag = false;
	function timerSet() {
		if (flag == false) {
			flag = true;
			timer = window.setInterval("queryData()", 1500);
		} else {
			flag = false;
			window.clearInterval(timer);
		}
	}
</script>

	</head>

	<body>
		<f:subview id="monitor">
			<h:form id="win">
				<h:panelGrid columns="1">
					<rich:dataTable id="worktable" var="work" align="center"
						value="#{httpQueryBean.workPlatform}" rowKeyVar="row"
						width="800px">
						<f:facet name="header">
							<rich:columnGroup>
								<rich:column colspan="6">
									<h:outputText>工作面信息</h:outputText>
								</rich:column>
								<rich:column breakBefore="true">
									<h:outputText>矿点</h:outputText>
								</rich:column>
								<rich:column>
									<h:outputText>工作面编号</h:outputText>
								</rich:column>
								<rich:column>
									<h:outputText>走向长</h:outputText>
								</rich:column>
								<rich:column>
									<h:outputText>倾向长</h:outputText>
								</rich:column>
								<rich:column>
									<h:outputText>采高</h:outputText>
								</rich:column>
								<rich:column>
									<h:outputText>煤层厚度</h:outputText>
								</rich:column>
							</rich:columnGroup>
						</f:facet>
						<rich:columnGroup>
							<rich:column>
								<h:outputText value="#{work.nodeId}"></h:outputText>
							</rich:column>
							<rich:column>
								<h:outputText value="#{work.BH}"></h:outputText>
							</rich:column>
							<rich:column>
								<h:outputText value="#{work.ZXC}"></h:outputText>
							</rich:column>
							<rich:column>
								<h:outputText value="#{work.QXC}"></h:outputText>
							</rich:column>
							<rich:column>
								<h:outputText value="#{work.CG}"></h:outputText>
							</rich:column>
							<rich:column>
								<h:outputText value="#{work.MCHD}"></h:outputText>
							</rich:column>
						</rich:columnGroup>
						<f:facet name="footer"></f:facet>
					</rich:dataTable>
				</h:panelGrid>
				<br />
				<a4j:commandButton id="btn" value="开始"
					action="#{httpQueryBean.query}" onclick="timerSet();"
					reRender="worktable"></a4j:commandButton>
			</h:form>
			<h:form>
				<a4j:jsFunction name="queryData" action="#{httpQueryBean.query}"
					reRender="worktable"></a4j:jsFunction>
			</h:form>
		</f:subview>
	</body>
</html>
